package com.weiyi.weiman.mapper.comics;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import comics.Comics;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author zhang
 * @Date 2021/5/6 下午4:42
 * @Description 漫画相关持久化操作
 * @Version 1.0
 **/
public interface ComicsMapper extends BaseMapper<Comics> {

    /**
     * 通过id判断漫画是否存在
     * @param comicsId
     * @return
     */
    @Select("SELECT COUNT(*) FROM wm_comics WHERE comics_id = #{comicsId}")
    int isExists(@Param("comicsId") long comicsId);

    @Select("SELECT comics_id,comics_like,comics_collect,comics_visitor,comics_search,platform_source" +
            " FROM wm_comics ORDER BY gwt_update LIMIT #{limit}")
    List<Comics> getLatestComicsIndex(int limit);
}
